import { useEffect, useState } from 'react'
import { getChannelListAPI, type ChannelItems } from '@/apis/list'

function useTabs() {
  const [channels, setChannels] = useState<ChannelItems[]>([])

  useEffect(() => {
    const getChannels = async () => {
      try {
        const res = await getChannelListAPI()
        setChannels(res.data.data.channels)
      } catch (error) {
        // 处理错误
        console.log(error)
      }
    }
    getChannels()
  }, [])

  return {
    channels,
  }
}

export { useTabs }

// export default useTabs;
